<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    
    <title>GeoExt.data.StyleReader &mdash; GeoExt v1.1</title>
    <link rel="stylesheet" href="../../../_static/geoext.css" type="text/css" />
    <link rel="stylesheet" href="../../../_static/pygments.css" type="text/css" />
    <script type="text/javascript">
      var DOCUMENTATION_OPTIONS = {
        URL_ROOT:    '../../../',
        VERSION:     '1.1',
        COLLAPSE_MODINDEX: false,
        FILE_SUFFIX: '.html',
        HAS_SOURCE:  true
      };
    </script>
    <script type="text/javascript" src="../../../_static/jquery.js"></script>
    <script type="text/javascript" src="../../../_static/doctools.js"></script>
    <link rel="shortcut icon" href="../../../_static/favicon.ico"/>
    <link rel="top" title="GeoExt v1.1" href="../../../index.html" />
    <link rel="up" title="GeoExt.data" href="../data.html" />
    <link rel="next" title="GeoExt.data.WFSCapabilitiesReader" href="WFSCapabilitiesReader.html" />
    <link rel="prev" title="GeoExt.data.ScaleStore" href="ScaleStore.html" />
    
    
    
    
    

  </head>
  <body>
    <div class="header">
        <div class="wrap">
            <h1 id="logo"><a href="../../../index.html">GeoExt</a></h1>
            <ul id="top-nav">
                <li class="first"><a href="../../../docs.html">Documentation</a></li>
                <li><a href="../../../examples.html">Examples</a></li>
                <li><a href="../../../downloads.html">Download</a></li>
                <li><a href="http://trac.geoext.org/">Development</a></li>
            </ul>
            <div id="searchbox">
                <form class="search" action="../../../search.html" method="get">
                    <input id="searchbox-query" type="text" name="q" size="25" value="Search &hellip;" tabindex="3" onblur="if(this.value=='') this.value='Search &hellip;';" onfocus="if(this.value=='Search &hellip;') this.value='';" />
                    <input id="searchbox-submit" type="image" value="Search" src="../../../_static/img/search_icon_green.png" />
                    <input type="hidden" name="check_keywords" value="yes" />
                    <input type="hidden" name="area" value="default" />
                </form>
            </div>
        </div>
    </div>

    <div class="related">
      <h3>Navigation</h3>
      <ul>
        <li><a href="../../../index.html">GeoExt</a> &raquo;</li>
          <li><a href="../../index.html" >API Reference</a> &raquo;</li>
          <li><a href="../data.html" accesskey="U"><tt class="docutils literal docutils literal docutils literal docutils literal docutils literal docutils literal docutils literal docutils literal docutils literal docutils literal docutils literal docutils literal docutils literal docutils literal docutils literal"><span class="pre">GeoExt.data</span></tt></a> &raquo;</li>
        <li><a href="#"><tt class="docutils literal docutils literal"><span class="pre">GeoExt.data.StyleReader</span></tt></a></li>
      </ul>
    </div>

      <div class="sphinxsidebar">
        <div class="sphinxsidebarwrapper">
            <h3><a href="../../../index.html">Table Of Contents</a></h3>
            <ul>
<li><a class="reference external" href="#"><tt class="docutils literal"><span class="pre">GeoExt.data.StyleReader</span></tt></a><ul>
<li><a class="reference external" href="#example-use">Example Use</a></li>
</ul>
</li>
</ul>

            <h4>Previous topic</h4>
            <p class="topless"><a href="ScaleStore.html"
                                  title="previous chapter"><tt class="docutils literal docutils literal docutils literal"><span class="pre">GeoExt.data.ScaleStore</span></tt></a></p>
            <h4>Next topic</h4>
            <p class="topless"><a href="WFSCapabilitiesReader.html"
                                  title="next chapter"><tt class="docutils literal"><span class="pre">GeoExt.data.WFSCapabilitiesReader</span></tt></a></p>
        </div>
      </div>


    <div class="document">
      <div class="documentwrapper">
        <div class="bodywrapper">
          <div class="body">
            
  <div class="section" id="geoext-data-stylereader">
<h1><a title="GeoExt.data.StyleReader" class="reference internal" href="#GeoExt.data.StyleReader"><tt class="xref docutils literal"><span class="pre">GeoExt.data.StyleReader</span></tt></a><a class="headerlink" href="#geoext-data-stylereader" title="Permalink to this headline">¶</a></h1>
<dl class="meta docutils">
<dt>Extends</dt>
<dd><ul class="first last simple">
<li><a class="reference external" href="http://dev.sencha.com/deploy/dev/docs/?class=Ext.data.JsonReader">Ext.data.JsonReader</a></li>
</ul>
</dd>
</dl>
<dl class="class">
<dt id="GeoExt.data.StyleReader">
<em class="property">class </em><tt class="descclassname">GeoExt.data.</tt><tt class="descname">StyleReader</tt><a class="headerlink" href="#GeoExt.data.StyleReader" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

<p>A smart reader that creates records for client-side rendered legends. If
its store is configured with an <tt class="docutils literal"><span class="pre">OpenLayers.Style2</span></tt> instance as <tt class="docutils literal"><span class="pre">data</span></tt>,
each record will represent a Rule of the Style, and the store will be
configured with <tt class="docutils literal"><span class="pre">symbolizers</span></tt> (Array of <tt class="docutils literal"><span class="pre">OpenLayers.Symbolizer</span></tt>),
<tt class="docutils literal"><span class="pre">filter</span></tt> (<tt class="docutils literal"><span class="pre">OpenLayers.Filter</span></tt>), <tt class="docutils literal"><span class="pre">label</span></tt> (String, the rule&#8217;s title),
<tt class="docutils literal"><span class="pre">name</span></tt> (String), <tt class="docutils literal"><span class="pre">description</span></tt> (String), <tt class="docutils literal"><span class="pre">elseFilter</span></tt> (Boolean),
<tt class="docutils literal"><span class="pre">minScaleDenominator</span></tt> (Number) and <tt class="docutils literal"><span class="pre">maxScaleDenominator</span></tt> (Number)
fields. If the store&#8217;s <tt class="docutils literal"><span class="pre">data</span></tt> is an <tt class="docutils literal"><span class="pre">OpenLayers.Symbolizer.Raster</span></tt>
instance, records will represent its ColorMap entries, and the available
fields will only be <tt class="docutils literal"><span class="pre">symbolizers</span></tt> (object literal with <tt class="docutils literal"><span class="pre">color</span></tt> and
<tt class="docutils literal"><span class="pre">opacity</span></tt> properties from the ColorMapEntry, and stroke set to false),
<tt class="docutils literal"><span class="pre">filter</span></tt> (String, the ColorMapEntry&#8217;s quantity) and <tt class="docutils literal"><span class="pre">label</span></tt> (String).</p>
<p>The store populated by this reader is synchronized with the underlying data
object. To write back changes to the Style or Symbolizer object, call
<tt class="docutils literal"><span class="pre">commitChanges</span></tt> on the store.</p>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">Calling <tt class="docutils literal"><span class="pre">commitChanges</span></tt> on the store that is populated with
this reader will fail with OpenLayers 2.11 - it requires at least
revision
<a class="reference external" href="https://github.com/openlayers/openlayers/commit/1db5ac3cbe874317968f78832901d6ef887ecca6">https://github.com/openlayers/openlayers/commit/1db5ac3cbe874317968f78832901d6ef887ecca6</a>
from 2011-11-28 of OpenLayers.</p>
</div>
<div class="section" id="example-use">
<h2>Example Use<a class="headerlink" href="#example-use" title="Permalink to this headline">¶</a></h2>
<p>Sample code to create a store that reads from an <tt class="docutils literal"><span class="pre">OpenLayers.Style2</span></tt>
object:</p>
<div class="highlight-javascript"><div class="highlight"><pre><span class="kd">var</span> <span class="nx">store</span> <span class="o">=</span> <span class="k">new</span> <span class="nx">Ext</span><span class="p">.</span><span class="nx">data</span><span class="p">.</span><span class="nx">Store</span><span class="p">({</span>
    <span class="nx">reader</span><span class="o">:</span> <span class="k">new</span> <span class="nx">GeoExt</span><span class="p">.</span><span class="nx">data</span><span class="p">.</span><span class="nx">StyleReader</span><span class="p">(),</span>
    <span class="nx">data</span><span class="o">:</span> <span class="nx">myStyle</span> <span class="c1">// OpenLayers.Style2 or OpenLayers.Symbolizer.Raster</span>
<span class="p">});</span>
</pre></div>
</div>
</div>
</div>


          </div>
        </div>
      </div>
      <div class="clearer"></div>
    </div>
    <div class="related">
      <h3>Navigation</h3>
      <ul>
            <li class="right" style="margin-right: 10px">
              <a href="../../../genindex.html" title="General Index"
                 accesskey="I">index</a></li>
            <li class="right" >
              <a href="../../../modindex.html" title="Global Module Index"
                 accesskey="M">modules</a> |</li>
            <li class="right" >
              <a href="WFSCapabilitiesReader.html" title="GeoExt.data.WFSCapabilitiesReader"
                 accesskey="N">next</a> |</li>
            <li class="right" >
              <a href="ScaleStore.html" title="GeoExt.data.ScaleStore"
                 accesskey="P">previous</a> |</li>
        <li><a href="../../../index.html">GeoExt</a> &raquo;</li>
          <li><a href="../../index.html" >API Reference</a> &raquo;</li>
          <li><a href="../data.html" ><tt class="docutils literal docutils literal docutils literal docutils literal docutils literal docutils literal docutils literal docutils literal docutils literal docutils literal docutils literal docutils literal docutils literal docutils literal docutils literal"><span class="pre">GeoExt.data</span></tt></a> &raquo;</li>
        <li><a href="#"><tt class="docutils literal docutils literal"><span class="pre">GeoExt.data.StyleReader</span></tt></a></li>
      </ul>
    </div>

    <div class="footer">
      &copy; Copyright 2009-2010, GeoExt Community.
    </div>
  </body>
</html>